import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Sort from '../views/Sort.vue'
import Mine from '../views/Mine.vue'
import Cart from '../views/Cart.vue'
import Error from '../views/Error.vue'
import Footer from '../components/Footer/Footer'
import Deatil from '../views/Detail.vue'
import Login from '../views/Login.vue'
import Register from '../views/register/Register.vue'
import Reg1 from '../views/register/Reg1.vue'
import Reg2 from '../views/register/Reg2.vue'
import Reg3 from '../views/register/Reg3.vue'

Vue.use(VueRouter)

const routes = [
  {
    path:"/",
    redirect: "/home"
  },
  {
    path: '/home',
    name: 'Home',
    components: {
      default:Home,
      Footer
    }
  },
  {
    path: '/sort',
    name: 'Sort',
    components: {
      default:Sort,
      Footer
    }
  },
  {
    path: '/cart',
    name: 'Cart',
    components: {
      default:Cart,
      Footer
    }
  },
  {
    path: '/mine',
    name: 'Mine',
    components: {
      default:Mine,
      Footer
    }
  },
  {
    path:"*",
    name: 'Error',
    component: Error
  },
  {
    path: '/login',
    name: "Login",
    component: Login
  },
  {
    path: '/register',
    name: "Register",
    component: Register,
    redirect: 'register/one',
    children: [
      {
        path: "/register/one",
        name:"Reg1",
        component:Reg1
      },
      {
        path: "/register/two",
        name:"Reg2",
        component:Reg2
      },
      {
        path: "/register/three",
        name:"Reg3",
        component:Reg3
      }
    ]
  },
  {
    path:"/pro/detail/:proid",
    name: 'Deatil',
    component: Deatil
  },

]

const router = new VueRouter({
  routes
})

export default router
